from django.db import models

class Usuario(models.Model):
    nome = models.CharField(max_length=100)
    cpf = models.CharField(max_length=20)
    telefone1 = models.CharField(max_length=14)
    telefone2 = models.CharField(max_length=14)
    email = models.EmailField(max_length=100)
    senha = models.CharField(max_length=100)
    dataCadatro = models.DateTimeField('data do cadastro')
    
    perfil = models.IntegerField() #1. Agricultor 2. Agronomo 3. Administrador
    #endereco
    logradouro = models.CharField(max_length=100) #av. Boa viagem 184
    complemento = models.CharField(max_length=100)
    bairro = models.CharField(max_length=100)
    cidade = models.CharField(max_length=100)
    UF = models.CharField(max_length=2)
    CEP = models.CharField(max_length=10)
    
class Pergunta(models.Model):
    titulo = models.CharField(max_length=100)
    corpo = models.TextField()
    dataPublicacao  = models.DateTimeField('data da publicacao da pergunta')
    usuario = models.ForeignKey(Usuario) 
    
class Resposta(models.Model):
    titulo = models.CharField(max_length=100)
    corpo = models.TextField()
    dataPublicacao  = models.DateTimeField('data da publicacao da resposta')
    usuario = models.ForeignKey(Usuario)   
    pergunta = models.ForeignKey(Pergunta)
    
    
    
    
    
